******************************************************************************************************
******************************************************************************************************
*																						             *
* NEVER FORGET THE FIRST TIME: THE PERSISTENT EFFECT OF CORRUPTION AND THE RISE OF POPULISM IN ITALY *
*																						             *
******************************************************************************************************
******************************************************************************************************

** NOTE:	
* Run on STATA 17
* To run it is required the installation of the package coeffplot		


** Setting working directories for input and output files

global dataout "PUT HERE THE DIRECTORY WHERE THE FOLDER RESULT IS LOCATED"
global datain "PUT HERE THE DIRECTORY WHERE THE FOLDER DATA IS LOCATED"


** Open Log file

log using ${dataout}log.log, replace


*---------------------------------------------  TABLES


************ Table 1
use ${datain}trustlab.dta, clear

foreach var in trust_parl trust_gov trust_civser {

reg `var' T  if country==6, r cluster(birth_year)

reg `var' T  i.code_region_resid_istat if country==6, r cluster(birth_year)

reg `var' T female birth_dec boost female catho birth_dec i.edufirst i.code_region_resid_istat if country==6, r cluster(birth_year)
}



************ Table 2

** Columns 1-6, Upper panel
use ${datain}trustlab.dta, clear

foreach var in vote2018 populists {
	
reg `var' T  if country==6, r cluster(birth_year)

reg `var' T  i.code_region_resid_istat if country==6, r cluster(birth_year)

reg `var' T female birth_dec boost birth_dec catho i.edufirst i.code_region_resid_istat if country==6, r cluster(birth_year)
}

** Columns 7-9, Upper panel
use ${datain}itanes2018.dta, clear

foreach var in populists  {

reg `var' T , r cluster(birth)

reg `var' T  i.regione, r cluster(birth)

reg `var' T catho i.educ2 female birth_dec i.regione, r cluster(birth)
}

** Columns 1-6, Lower panel
use ${datain}trustlab.dta, clear

foreach var in vote2018 populists  {
	
logit `var' i.T  if country==6, or r cluster(birth_year)
margins i.T, contrast(eff)  

logit `var' i.T  i.code_region_resid_istat if country==6, or r cluster(birth_year)
margins i.T, contrast(eff)  

logit `var' i.T female birth_dec boost female birth_dec catho i.edufirst i.code_region_resid_istat if country==6, or r cluster(birth_year)
margins i.T, contrast(eff) 
}

** Columns 7-9, Lower panel
use ${datain}itanes2018.dta, clear

foreach var in populists  {
logit `var' 1.T , r cluster(birth) or
margins i.T, contrast(eff) 

logit `var' 1.T  i.regione, r cluster(birth) or
margins i.T, contrast(eff) 

logit `var' 1.T catho i.educ2 female birth_dec i.regione, or r cluster(birth)
margins i.T, contrast(eff) 
}



************ Table 3
use ${datain}trustlab.dta, clear

** Upper panel
foreach var in party_1 party_2 party_3 party_4 party_5 party_6 party_7  {

reg `var' T female birth_dec boost female birth_dec catho i.edufirst i.code_region_resid_istat if country==6, r cluster(birth_year)
}

** Lower panel
mlogit party i.T female birth_dec boost i.edufirst catho i.code_region_resid_istat if country==6, r cluster(birth_year) 

forvalues i=1(1)7 {
margins i.T, contrast(eff) predict(outcome(`i')) 
}



************ Table A.1

** Rows 1-20
use ${datain}trustlab.dta, clear

sum trust_parl trust_gov trust_civser inst_lt_obj inst_integr inst_transp trust_media trust_fininst trust_police  vote2018 populists  female catho edufirst_2 unemployed south q_corr_2  d_pil_xc d_unemp stragi if country==6

stddiff trust_parl trust_gov trust_civser inst_lt_obj inst_integr inst_transp trust_media trust_fininst trust_police  vote2018 populists  female catho edufirst_2 unemployed south q_corr_2  d_pil_xc d_unemp stragi if country==6, by(t_rev) hedgesg

** Rows 21, 22 and 27
use ${datain}itanes2018.dta, clear

sum trust_parl trust_part populist 
stddiff trust_parl trust_part populist, by(t_rev) hedgesg

** Rows 23, 25, 26 and 28-34
use ${datain}itanes1996.dta, clear

sum ditta pol_int2 pol_int  lega_2 lega_1  an_2 an_1 dc_2 psi_2 abstent
stddiff ditta pol_int pol_int2 lega_2 lega_1  an_2 an_1 dc_2 psi_2 abstent, by(t_rev) hedgesg

** Row 24
use ${datain}itanes2001.dta, clear

sum trust_parl
stddiff trust_parl, by(t_rev) hedgesg



************ Table A.2
use ${datain}trustlab.dta, clear

reg trust_parl T female birth_dec boost female catho birth_dec i.edufirst i.code_region_resid_istat if country==6, r cluster(birth_year)
ta first if e(sample)



************ Table A.3 
use ${datain}trustlab.dta, clear

foreach var in trust_parl trust_gov trust_civser{

reg `var' i.T##i.q_corr_2 catho old1991 lab1991  edu1991  firms1991 female boost i.edufirst i.code_macroreg_child_istat if country==6, r cluster(birth_year)
}



************ Table A.4
use ${datain}trustlab.dta, clear

foreach var in inst_lt_obj inst_integr inst_transp trust_media trust_fininst trust_police   {
	
reg `var' T female birth_dec  boost i.edufirst catho i.code_region_resid_istat if country==6, r cluster(birth_year)
}



*************** Table A.5
use ${datain}trustlab.dta, clear

foreach var in income_ln unemployed public_sec info_tv info_internet o_mean c_mean e_mean a_mean n_mean {
	
reg `var' 1.T birth_dec boost female catho i.edufirst i.code_region_resid_istat if country==6, r cluster(birth_year)
}



********* Table A.6
use ${datain}trustlab.dta, clear

** Columns 1-3
foreach var in trust_parl trust_gov trust_civser {
	
reghdfe `var' T female birth_dec boost female catho birth_dec i.edufirst i.code_region_resid_istat age_int if country==6, noabsorb cluster(birth_year)
}

** Columns 4-6
foreach var in trust_parl trust_gov trust_civser  {
	
reghdfe `var' T female birth_dec boost female catho birth_dec  i.edufirst i.code_region_resid_istat if country==6, noabsorb cluster(birth_year code_region_resid_istat)
}



************ Table A.7 

** Columns 1-2
use ${datain}itanes2018.dta, clear

foreach var in  trust_parl trust_part {

reg `var' T catho i.educ2 female birth_dec i.regione, r cluster(birth)
}

** Column 3
use ${datain}itanes2001_2018.dta, clear

foreach var in  trust_parl {

reg `var' T catho female birth_dec i.age i.regione, r cluster(birth)
}



************ Table A.8

** Columns 1-3
use ${datain}itanes1996.dta, clear

foreach var in ditta pol_int pol_int2 {

reg `var' T 1.religious_group i.education i.gender i.region  birth_dec, r cluster(birth)
}

** Column 4
use ${datain}itanes2001.dta, clear

foreach var in  trust_parl{
	
reg `var' T catho  i.educ2 female  birth_dec i.regione, r cluster(birth)
}



************ Table A.9
use ${datain}trustlab.dta, clear

foreach var in trust_parl trust_gov trust_civser {

reg `var' T stragi inter_mafia female birth_dec catho boost i.edufirst i.code_region_child_istat  if country==6, r cluster(birth_year)
}



************ Table A.10
use ${datain}trustlab.dta, clear

foreach var in trust_parl trust_gov trust_civser {

reg `var' T d_unemp inter_unemp female birth_dec catho boost i.edufirst i.code_region_child_istat  if country==6, r cluster(birth_year)
}



************ Table A.11
use ${datain}trustlab.dta, clear

foreach var in trust_parl trust_gov trust_civser {

reg `var' T d_pil_xc inter_gdp female birth_dec catho boost i.edufirst i.code_region_child_istat  if country==6, r cluster(birth_year)
}



************ Table A.12
use ${datain}trustlab.dta, clear

reg populists T female birth_dec boost female i.birth_dec catho i.edufirst i.code_region_resid_istat if country==6, r cluster(birth_year)
ta first if e(sample)



************ Table A.13
use ${datain}trustlab.dta, clear

stddiff T female catho  edufirst_2  unemployed if country==6, by(nofollow) hedgesg



************ Table A.14
use ${datain}trustlab.dta, clear

fvset base 6 first

foreach var in trust_parl trust_gov trust_civser  {
	
reg `var' i.first female  boost female catho i.code_region_resid_istat i.edufirst if country==6, r cluster(birth_year)
}

foreach var in  populists {
	
reg `var' i.first female catho i.education  female boost  i.code_region_resid_istat if country==6, r cluster(birth_year)
}



************ Table A.15
use ${datain}trustlab.dta, clear

fvset base 6 first

foreach var in trust_parl trust_gov trust_civser {

reg `var' i.first##1.italy  female birth_dec catho i.edufirst  i.birth_year  cou_1 cou_2 cou_3 cou_4 cou_5 cou_7 if boost!=1, r cluster(birth_year)
}



************ Table A.16
use ${datain}trustlab.dta, clear

foreach var in  party_3 party_4 {
	
reg `var' T south inter_south female birth_dec  boost catho i.edufirst i.code_region_resid_istat if country==6 , r cluster(birth_year)  
}



************ Table A.17
use ${datain}itanes1996.dta, clear

foreach var in lega_2 lega_1 an_2 an_1 {

reg `var' T 1.religious_group i.education i.gender i.region  birth_dec if birth!=1977, r cluster(birth)
}



************ Table A.18
use ${datain}itanes1996.dta, clear

foreach var in dc_2 psi_2 abstent  {

reg  `var' T 1.religious_group i.education i.gender i.region  birth_dec, r cluster(birth) 
}



************ Table A.19
use ${datain}trustlab.dta, clear

foreach var in  populist {

reg `var' T female trust_parl i.birth_dec boost catho i.edufirst i.code_region_resid_istat if country==6 , r cluster(birth_year)

reg `var' T female trust_gov i.birth_dec boost catho i.edufirst i.code_region_resid_istat if country==6, r cluster(birth_year)

reg `var' T female trust_civser i.birth_dec boost catho i.edufirst i.code_region_resid_istat if country==6, r cluster(birth_year)

reg `var' T female d_unemp i.birth_dec boost catho i.edufirst i.code_region_resid_istat if country==6, r cluster(birth_year)

reg `var' T female d_pil_xc i.birth_dec boost catho i.edufirst i.code_region_resid_istat if country==6, r cluster(birth_year)

reg `var' T female stragi i.birth_dec boost catho i.edufirst i.code_region_resid_istat if country==6, r cluster(birth_year)

reg `var' T female trust_parl trust_gov trust_civser i.birth_dec boost catho i.edufirst i.code_region_resid_istat if country==6, r cluster(birth_year)
}



************ Table A.20
use ${datain}itanes1994.dta, clear

foreach var in comizzi comizzi_tv convinto cercato poster {

reg `var' T 1.religious_group i.education i.gender i.region  birth_dec, r cluster(birth)
}





*---------------------------------------------  FIGURES


************ Figure 1

** Panel (a) 
use ${datain}fig1panelA.dta, clear

preserve
bysort leg corr: gen cases_2=_N if corr==1
collapse cases_2, by(leg)
line cases_2 leg, ytitle("Number of charges for corruption (art.110)", s(vsmall)) title("(a): RAPs", s(small)) xlabel(1 "I/1948-53" 2 "II/1953-58" 3 "III/1958-63" 4 "IV/1963-68" 5 "V/1968-72" 6 "VI/1972-76" 7 "VII/1976-79" 8 "VIII/1979-83" 9 "IX/1983-87" 10 "X/1987-92" 11 "XI/1992-94", labs(vsmall) angle(45)) ylab(,labs(vsmall)) graphregion(color(white)) bgcolor(white) lc(black) xtitle("Legislature",s(small)) title(, c(black))
graph save ${dataout}fig1panelA.gph, replace
restore

** Panel (b) 
use ${datain}fig1panelB.dta, clear

sort year
twoway (line corruzione year, ytitle("Yearly number of appereances of corruption", s(vsmall)) xlabel(, labs(vsmall) angle(45)) title("Panel (b): Newspapers - Corriere della Sera", s(small) c(black)) xtitle("") graphregion(color(white)) bgcolor(white) lc(black)),   xline(1992, lc(black) lp(dash)) xline(1994, lw(thick))  xline(1996, lc(black) lp(dash)) xlab(, labs(vsmall)) ylab(,labs(vsmall))
graph save ${dataout}fig1panelB.gph, replace

** Panel (c) 
use ${datain}fig1panelC.dta, clear

replace corruzione=corruzione*100
replace calcio=calcio*100

twoway (line corruzione year, xtitle("") graphregion(color(white)) bgcolor(white) lc(black) xlab(, labs(vsmall)) ylab(,labs(vsmall))) (line calcio year, ytitle("Percentage of Italian books", s(vsmall)) title("Panel (c): Books", s(small) c(black)) xtitle("") graphregion(color(white)) bgcolor(white) lc(black) lp(dash) xlab(, labs(vsmall)) ylab(,labs(vsmall))), legend(off) 
graph save ${dataout}fig1panelC.gph, replace

** Panel (d) 
use ${datain}fig1panelD.dta, clear

* We calculate the average duration within 90 days before each electoral round
egen mean_1=mean(duration) if date>(d(5Apr1992)-90) & date<(d(5Apr1992)) 
egen mean_2=mean(duration) if date>(d(27Mar1994)-90) & date<(d(27Mar1994))
egen mean_3=mean(duration) if date>(d(21Apr1996)-90) & date<(d(21Apr1996)) 
egen mean_4=mean(duration) if date>(d(13May2001)-90) & date<(d(13May2001)) 
egen mean_5=mean(duration) if date>(d(10Apr2006)-90) & date<(d(10Apr2006)) 
egen mean_6=mean(duration) if date>(d(14Apr2008)-90) & date<(d(14Apr2008)) 
egen mean_7=mean(duration) if date>(d(25Feb2013)-90) & date<(d(25Feb2013)) 

twoway (line duration date , lc(black)) (line mean_1 date, lp(dash_dot) lc(red) lw(vthick)) (line mean_2 date, lp(dash_dot) lc(red) lw(vthick)) (line mean_3 date, lp(dash_dot) lc(red) lw(vthick)) (line mean_4 date, lp(dash_dot) lc(red) lw(vthick)) (line mean_5 date, lp(dash_dot) lc(red) lw(vthick)) (line mean_6 date, lp(dash_dot) lc(red) lw(vthick)) (line mean_7 date, lp(dash_dot) lc(red) lw(vthick)), xtitle("")  xline(`=d(5Apr1992)', lc(black) lp(dash)) xline(`=d(27Mar1994)', lw(thick))  xline(`=d(21Apr1996)', lc(black) lp(dash)) xline(`=d(13May2001)', lc(black) lp(dash))  xline(`=d(10Apr2006)', lc(black) lp(dash)) xline(`=d(14Apr2008)', lc(black) lp(dash))  xline(`=d(25Feb2013)', lc(black) lp(dash)) ytitle("Total daily minutes assigned to political corruption", s(vsmall)) graphregion(color(white)) bgcolor(white) legend(off) ylab(, labs(vsmall)) xlab(, labs(vsmall) angle(45)) title("Panel (d): TV/radio - Public channels", s(small) c(black))
graph save ${dataout}fig1panelD.gph, replace

cd ${dataout}
graph combine fig1panelA.gph fig1panelB.gph fig1panelC.gph fig1panelD.gph, c(2) r(2) graphregion(color(white))
graph export ${dataout}fig1.eps, replace



************ Figure 2
use ${datain}trustlab.dta, clear

fvset base 6 first

reg trust_parl i.first female  boost  i.edufirst catho i.code_region_resid_istat if country==6, r cluster(birth_year)
est store reg1

reg trust_gov i.first female  boost   i.edufirst catho i.code_region_resid_istat if country==6, r cluster(birth_year)
est store reg2

reg trust_civser i.first female  boost i.edufirst catho i.code_region_resid_istat if country==6, r cluster(birth_year)
est store reg3

coefplot  (reg1, base offset(-0.15)  label("Trust Parl. ")) (reg2, offset(0)  label("Trust Gov.")) (reg3, offset(0.15) label("Trust Civ.")), vertical base omitted keep( *.first* )  yline(0, lp(dash)) xline(6, lpattern(dash)) xlabel(, labs(small) angle(45)) ms(m)  ylabel(, angle(horizotal) labsize(vsmall)) leg(c(6) size(small))  graphregion(color(white)) msize(small) levels(99 95 90) title("", s(small) c(black)) ytitle("Point estimates", s(small)) scheme(s2mono)
graph export ${dataout}fig2.eps, replace



************ Figure 3
use ${datain}trustlab.dta, clear

fvset base 6 first

reg populists i.first female  boost i.education catho i.code_region_resid_istat if country==6, r cluster(birth_year) 

coefplot, keep( *.first* ) levels(99, 95 90) omitted baselevels vertical  xlabel(,angle(45) labs(vsmall)) scheme(s2mono) yline(0, lpattern(dash)) graphregion(color(white)) xline(6 , lpattern(dash)) ylab(, labs(vsmall)) name(nochange, replace)   ytitle("Point estimates" , s(small))  ylabel(, labs(small)) graphregion(color(white)) bgcolor(white)
graph export ${dataout}fig3.eps, replace



************ Figure A.1
use ${datain}figA1.dta, clear

twoway (line index year if year>1961, yaxis(1) yscale(range(0) axis(1)) ytitle("Percentage of respondents", s(vsmall)) xtitle("") graphregion(color(white)) bgcolor(white) lc(black)  xlab(1962(2)2004 2008 2012, labs(vsmall) angle(45)) ylab(0(5)65,labs(vsmall) axis(1))) (line hardly year if year>1961, yaxis(2) yscale(range(0) axis(2)) ytitle("Percentage of respondents", s(vsmall) axis(2)) xtitle("") graphregion(color(white)) bgcolor(white) lc(black) lp(dash)  xlab(, labs(vsmall)) ylab( 0(5)30,labs(vsmall)  axis(2))), legend(label(1 "Trust in Federal government - Left axis") label(2 "Politicians are hardly corrupt - Right axis") r(2))
graph export ${dataout}figA1.eps, replace



************ Figure A.2
use ${datain}figA2.dta, clear

graph bar  charged if year==1992, over(party, label(labs(vsmall) angle(-45))) title("1992", c(black)) ytitle("Number of Parlamentarians charged for corruption", s(small)) graphregion(color(white)) bgcolor(white) ylab(,labs(vsmall))  bar(1,color(black) fin(inten50))
graph save ${dataout}charged_1992.gph, replace
graph bar  charged if year==1993, over(party, label(labs(vsmall) angle(-45))) title("1993", c(black)) ytitle("") graphregion(color(white)) bgcolor(white) ylab(,labs(vsmall))  bar(1,color(black) fin(inten50))
graph save ${dataout}charged_1993.gph, replace
graph bar  charged if year==1994, over(party, label(labs(vsmall) angle(-45))) title("1994", c(black)) ytitle("") graphregion(color(white)) bgcolor(white) ylab(,labs(vsmall))  bar(1,color(black) fin(inten50))
graph save ${dataout}charged_1994.gph, replace

cd ${dataout}
graph combine charged_1992.gph charged_1993.gph charged_1994.gph, c(3) ycommon graphregion(color(white))
graph export ${dataout}figA2.eps, replace



************ Figure A.3
use ${datain}trustlab.dta, clear

foreach var in  trust_parl trust_gov trust_civser  {
	
local vtext : variable label `var'

twoway (hist `var' if T==1 & country==6, color(gray*.30) discrete) (hist `var' if T==0  & country==6,   fcolor(none) lcolor(black) discrete), legend(order(1 "1975/76" 2 "Other cohorts" )) graphregion(color(white)) bgcolor(white) title("`vtext'", s(small) c(black)) ylab(, labs(small)) xlab(, labs(small)) ytitle(, s(small)) xtitle("") 

graph save ${dataout}dis_`var'.gph, replace
}

* Combining graphs
cd ${dataout}
graph combine dis_trust_parl.gph dis_trust_gov.gph dis_trust_civser.gph  , graphregion(color(white)) r(2) ycommon 
graph export ${dataout}figA3.eps, replace



************ Figure A.4
use ${datain}trustlab.dta, clear

fvset base 6 first

reg trust_parl i.first i.first##1.italy  female catho i.edufirst   i.birth_year cou_1 cou_2 cou_3 cou_4 cou_5 cou_7 if boost!=1, r cluster(birth_year)
est store reg1

reg trust_gov i.first i.first##1.italy female catho i.edufirst   i.birth_year cou_1 cou_2 cou_3 cou_4 cou_5 cou_7 if boost!=1, r cluster(birth_year)
est store reg2

reg trust_civser i.first i.first##1.italy female catho i.edufirst   i.birth_year cou_1 cou_2 cou_3 cou_4 cou_5 cou_7 if boost!=1, r cluster(birth_year)
est store reg3

coefplot  (reg1, base offset(-0.15)  label("Trust Parl. ")) (reg2, offset(0)  label("Trust Gov.")) (reg3, offset(0.15) label("Trust Civ.")), vertical base omitted keep( *.first#1.italy* )  yline(0, lp(dash)) xline(6, lpattern(dash)) xlabel(, labs(small) angle(45)) ms(m)  ylabel(, angle(horizotal) labsize(vsmall)) leg(c(6) size(small))  graphregion(color(white)) msize(small) levels(99 95 90) title("", s(small) c(black)) ytitle("Point estimates", s(small)) scheme(s2mono)
graph export ${dataout}figA4.eps, replace



******** Figure A.5
** Panel (a) 
use ${datain}figA5panelA.dta, clear

* We calculate the average duration within 90 days before each electoral round
egen mean_1=mean(duration) if date>(d(5Apr1992)-90) & date<(d(5Apr1992)) 
egen mean_2=mean(duration) if date>(d(27Mar1994)-90) & date<(d(27Mar1994))
egen mean_3=mean(duration) if date>(d(21Apr1996)-90) & date<(d(21Apr1996)) 

* Graphing trends
twoway (line duration date , lc(black)) (line mean_1 date, lp(dash_dot) lc(red) lw(vthick)) (line mean_2 date, lp(dash_dot) lc(red) lw(vthick)) (line mean_3 date, lp(dash_dot) lc(red) lw(vthick)), xtitle("") xline(`=d(5Apr1992)', lc(black) lp(dash)) xline(`=d(27Mar1994)', lw(thick))  xline(`=d(21Apr1996)', lc(black) lp(dash)) xline(`=d(13May2001)', lc(black) lp(dash))  xline(`=d(10Apr2006)', lc(black) lp(dash)) xline(`=d(14Apr2008)', lc(black) lp(dash))  xline(`=d(25Feb2013)', lc(black) lp(dash)) ytitle("Total daily minutes assigned to mafia", s(small)) graphregion(color(white)) bgcolor(white) legend(off) ylab(, labs(vsmall)) xlab(, labs(small) angle(45)) title("Panel (a): Mafia", s(small) c(black))
graph save ${dataout}figA5panelA.gph, replace


** Panel (b) 
use ${datain}figA5panelB.dta, clear

* We calculate the average duration within 90 days before each electoral round
egen mean_1=mean(duration) if date>(d(5Apr1992)-90) & date<(d(5Apr1992)) 
egen mean_2=mean(duration) if date>(d(27Mar1994)-90) & date<(d(27Mar1994))
egen mean_3=mean(duration) if date>(d(21Apr1996)-90) & date<(d(21Apr1996)) 

* Graphing trends
twoway (line duration date , lc(black)) (line mean_1 date, lp(dash_dot) lc(red) lw(vthick)) (line mean_2 date, lp(dash_dot) lc(red) lw(vthick)) (line mean_3 date, lp(dash_dot) lc(red) lw(vthick)), xtitle("")  xline(`=d(5Apr1992)', lc(black) lp(dash)) xline(`=d(27Mar1994)', lw(thick))  xline(`=d(21Apr1996)', lc(black) lp(dash)) xline(`=d(13May2001)', lc(black) lp(dash))  xline(`=d(10Apr2006)', lc(black) lp(dash)) xline(`=d(14Apr2008)', lc(black) lp(dash))  xline(`=d(25Feb2013)', lc(black) lp(dash)) ytitle("Total daily minutes assigned to economic crisis", s(small)) graphregion(color(white)) bgcolor(white) legend(off) ylab(, labs(vsmall)) xlab(, labs(small) angle(45)) title("Panel (b): Economic crisis", s(small) c(black))
graph save ${dataout}figA5panelB.gph, replace

* Combining graphs
cd ${dataout}
graph combine figA5panelA.gph figA5panelB.gph , c(2) graphregion(color(white))
graph export ${dataout}figA5.eps, replace



************ Figure A.6
use ${datain}figA6.dta, clear

* We create a variable with the date 
gen date=ym( year , month)
format  date  %tmMon_CCYY
label var date "Date"

* We calculate the percentage of first pages in each month dedicated to corruption, mafia and economic crisis
gen perc= Corruzione_Corrieredellasera/num_uscite_corriere
gen perc2= Crisi_Corrieredellasera/num_uscite_corriere
gen perc3= Strage_Corrieredellasera/num_uscite_corriere
sort date

* Graphing trends
twoway (line perc date, ytitle("Monthly percentage of first pages  ", s(vsmall)) xlabel(, labs(vsmall) angle(45)) xtitle("") graphregion(color(white)) bgcolor(white) lc(black)) (line perc2 date, ytitle("Monthly percentage of first pages ", s(vsmall)) xlabel(, labs(vsmall) angle(45)) xtitle("") graphregion(color(white)) bgcolor(white) lc(black) lp(shortdash)) (line perc3 date, ytitle("Monthly percentage of first pages  ", s(vsmall)) xlabel(, labs(vsmall) angle(45)) xtitle("") graphregion(color(white)) bgcolor(white) lc(black) lp(dash_dot)),   tline(1992m4, lc(black) lp(dash)) tline(1994m3, lw(thick)) tline(1996m4, lc(black) lp(dash)) xlab(, labs(vsmall)) ylab(,labs(vsmall)) legend(label(1 "Corruption") label(2 "Mafia") label(3 "Economic crisis") c(3) )
graph export ${dataout}figA6.eps, replace



************ Figure A.7
use ${datain}figA7.dta, clear

replace voteshare = voteshare/100

graph twoway (line voteshare year if flag == 0, lcolor(red%80)) (line voteshare year if flag == 1, lcolor(blue%80)), legend(order(1 "Left-wing" 2 "Right-wing")) graphregion(color(white)) ytitle("Share of votes") xlabel(1994 1996 2001 2006 2008 2013 2018) xsize(6)

graph export ${dataout}figA7.eps, replace


************ Figure A.8
use ${datain}figA8.dta, clear

graph twoway (line populist election_year if flag == 1, color(red%80)) ///
(line populist election_year if flag == 2, color(green%80)) ///
(line populist election_year if flag == 3, color(blue%80)) ///
, legend(order(1 "Older than 1975" 2 "1975-1976" 3 "Younger than 1976") size(vsmall) rows(1) position(6)) graphregion(color(white)) ///
xlabel(1994 1996 2001 2006 2008 2013 2018, labsize(small))  xtitle("") ytitle("Share of votes")
graph export ${dataout}figA8.eps, replace



************ Figure A.9
use ${datain}trustlab.dta, clear

foreach var in populists { 
	
reg `var' 1.T##c.d_gdp catho female birth_dec boost i.edufirst  i.code_region_resid_istat if country==6 , r cluster(birth_year) 
}
margins i.T, at(c.d_gdp=(-.20(.05).20))

marginsplot, graphregion(color(white)) xlabel(,labs(small)) bgcolor(white) xtitle("% Change in GDP 2006-2013", s(small)) ytitle("Prob. to vote for populist parties", s(small)) title("") legend( order( 2 "Treated (1975/76)" 1 "Control")) xline(0, lc(black) lp(dash)) ylabel(, labs(small))
graph export ${dataout}figA9.eps, replace


log close
